Introduction to Electronic Publishing With Mathcad

 welcome to Mathcad Developer's Reference
Electronic Publishing with Mathcad

Mathcad's WYSIWYG environment allows you to do much more than calculate, Mathcad allows you to convey ideas with mathematics, graphs, text, and other supporting media. Once you've finished your work, you will probably want to share it with others. You have two options for distributing Mathcad-generated documents in formats retaining the live-math properties of Mathcad.

  • You can assemble your Mathcad documents into a Mathcad E-book with all the information of a printed page plus all the interactive math tools available in Mathcad. These E-books can be distributed to anyone who has a copy of Mathcad in the same version or higher as the one in which the book was saved.

  • You can assemble your Mathcad documents into a Web site using MathML. Web files will not allow users to interact with the math online, but they will be able to see all of your calculations and graphs as they appeared in your files without having Mathcad installed. If your readers do have Mathcad, they will be able to open HTML/MathML documents in Mathcad, returning them to a fully functional state.


Introduction to Electronic Books

Mathcad is known for the ease with which “live” math equations, text, and graphics can be combined in a single document. For authors and publishers, Mathcad’s Electronic Books provide an exciting on-line publishing medium. In an Electronic Book, formulas and numbers that are static on the printed page become “live” Mathcad regions. Graphs of equations become live Mathcad plots the reader can resize, recalculate, and modify.

As an author, you can assemble graphics, text, equations, animations, popup windows, and even web pages into an Electronic Book with all the information of a printed page plus all the interactive math tools available in Mathcad.

Special Features of Electronic Books

An Electronic Book is a lot like any printed book, but it has some features that make it especially useful:

  • Every page in a Mathcad Electronic Book is a live Mathcad worksheet. You can change values, calculate results, and experiment with its contents right in the pages of the book itself.

  • Readers can drag and drop data and formulas from the book into their working documents.

  • An Electronic Book can have a table of contents, a searchable index, and live cross-referencing links.

  • Popup windows enable an author to add detailed information or tutorial help that does not interfere with the flow of information.

  • Electronic Book controls via the toolbar enable the reader to browse through a book or jump directly to the table of contents or other main sections.

  • Readers can annotate a copy of a Mathcad Electronic Book with their own notes. Mathcad maintains the original version separately.

The following sections discuss the steps to create your own Electronic Books.


Overview

As described in the Introduction to Electronic Books, an Electronic Book is a hyperlinked collection of Mathcad worksheets and related files. When you open an Electronic Book in Mathcad, it opens in its own window. The Electronic Book has a table of contents and an index as well as other browsing features which you can access using the buttons on the toolbar in the window. The worksheets in an Electronic Book are live so a reader can experiment directly within the book.

If you have several Mathcad worksheets that you want to collect together, you can create your own Electronic Book. The steps to creating an Electronic Book include:

  1. Creating individual Mathcad files

  2. Preparing a Table of Contents

  3. Adding hyperlinks between appropriate files

  4. Creating an HBK file to specify the order of the files in the book

  5. Developing an index

  6. Checking the index, HBK file, and worksheets for errors

Each step is explained in more detail in the following sections using an example of creating a sample Electronic Book called "Explorations in Algebra." It is recommended that you read all steps of the process before starting. After you've created an Electronic Book, you or others can open it in Mathcad and navigate through it using the toolbar buttons of the Electronic Book window.


Creating Mathcad Files

First create the Mathcad worksheets that will comprise your book. Place all the worksheets into a folder designated for your Electronic Book.

For example, for the Electronic Book titled "Explorations in Algebra," there are three Mathcad worksheets called FRACTIONS.MCD, PRIMES.MCD, and SQUARE.MCD. Store these files in a folder called ALGEBRA.

Place all subfolders that contain related files under the main folder. For example, if you have several worksheets related to a particular topic, you may want to create a subfolder containing those worksheets. It is also a good idea to place all popup worksheets in a subfolder called POPUPS.

To create a consistent look for your worksheets, you can create and use templates and text styles. Refer to Mathcad Help on templates and text styles for more information. Also see the section on tips for writing Mathcad worksheets for helpful suggestions on presentation of your work.

Once you have created your worksheets, you can prepare a table of contents for your Electronic Book.

Tip:

If you want to include data from a data file in a worksheet, you should insert an input table and import the data into it. This will ensure your book is readable even if it is on a CD or on a Web site. Refer to Mathcad Help on Importing Data from a Data File for information on importing data to an input table.


Tips for Writing Mathcad Worksheets

Studies have shown that people read up to 30% more slowly when information is on a computer screen than when it is on a hard copy. There are things you can do to help this situation. The key to good design is simplicity and consistency. Be consistent — repeated heads lead to clarity of presentation. Introduce each new section by letting the reader know the objectives for the section. Below are some presentation tips:

  • Use legible text. You should use legible fonts and sizes, and keep your text regions less than a screen width wide. Wide text lines are hard to read. Italic type and text that is not black on white is also harder to read on a computer screen. Use color for emphasis.

  • Separate paragraphs. If you have multiple paragraphs of text in succession, put each paragraph in a separate text region. This will give you greater control over the appearance of your documents and make it easier for you to reset your page breaks if you need to repaginate. Use hard page breaks to control the appearance of the pages with different displays and printer drivers. You should put in the hard page breaks when you are done with your revisions, as your changes may affect pagination.

  • Use headings. Use section heads and subheads to help organize your material and break it up for the reader. Long paragraphs of solid text that run on and on are tiring to the eyes.

  • Use bold, not italic. Use bold for emphasis within text, but don’t overuse it. Bold type is harder to read, and too many bold words will make the text appear choppy. Italic type is not as easy to read on a computer screen as on a printed page, so use it sparingly. Underlining should be reserved for hyperlinks.

  • Simplify style. Avoid using too many colors, text styles, and font styles in a document. Too much formatting can overwhelm the reader and make the information appear to be much more complicated than it actually is. Choose a few styles to emphasize information and use them consistently. Good design is invisible and does not distract from the meaning of the words.

  • Minimize scrolling. Remember that the reader will be viewing and using your material on the screen. Be sure they do not have to scroll back and forth too much in order to change values and see the results. Use of the global equals sign will help with that. It is also helpful to list your variables and definitions for the reader. The equation highlight features can be used to indicate where readers can intervene to manipulate values and see new results.

  • Organize your regions. Align your text, math, and graphics so the page does not appear cluttered and disorganized. See the section on aligning regions and using the Ruler guidelines.

  • Use Align Region feature. Use only a single space between sentences and words. Multiple spacing can lead to unsightly line wrapping on different displays. Avoid trying to align text by pressing the spacebar repeatedly. Most fonts have proportional spacing, which makes it virtually impossible to align text this way. Use the Align Region feature instead.

  • Size regions. You should also avoid using the [Enter] key to break a line of text in a text region. A reader who has a different display may find the lines break awkwardly if there are hard returns left at the ends of lines. A better approach is to reset the wrap margin for the text region itself by selecting the region, then grabbing the double arrow on the right side to shorten the region. This also avoids problems when editing and revising your text.

  • Provide hyperlinks. Provide hyperlinks that lead readers through your material in the order you wish them to view it. A table of contents with links to each section, or links within files to the next file will help the reader move along in a designated order.

  • Use "live" math. Math in Mathcad is live so use it to your advantage. Provide material for the user to interact with, suggest places they can change your numbers and variables, and give them graphs to see the results.

  • Organize your files. Number your files by chapter for easier organization later, i.e. ch1_1.mcd, ch1_2.mcd, ch1_3.mcd. For some networks, it is still preferable to use no more than 8 characters in the filenames.


Preparing a Table of Contents

Prepare a file called TOC.MCD containing a list of the topics that describe the worksheets in your Electronic Book. For example, in the “Explorations in Algebra” book, TOC.MCD could look like this:

Figure 1: Sample Table of Contents

The table of contents allows readers to browse to sections using hyperlinks to the files associated with each topic. The next section discusses adding hyperlinks between files.


Adding Hyperlinks Between Files

You can insert hyperlinks to Mathcad files from each of the topics in your table of contents to allow users to quickly browse the contents of your electronic books.

In this example, you would create hyperlinks from “Continued Fractions,” “Searching for Prime Numbers,” and “Journey Around the Square” to the files FRACTIONS.MCD, PRIMES.MCD, and SQUARE.MCD, respectively.

After creating the Mathcad worksheets, including the table of contents, you need to create an HBK file to bind the contents together.


Creating an HBK File

An HBK file for a Mathcad Electronic Book serves the same function as a traditional book binding: it specifies the order for the individual files in the book as the reader browses through it. The HBK file is a simple text file that provides:

  • The browse order or sequence of MCD files in your book.

  • The MCD files corresponding to the table of contents, index, and the opening page.

  • The text appearing in the title bar of the Electronic Book window when a reader turns to a particular section.

  • The title of the book as seen in the title bar and Open Book menu.

  • Title bar messages that appear when a reader clicks a hyperlink.

To create an HBK file:

  1. Use any text editor or word processing application.

  2. Enter the following four keywords at the beginning of the HBK file:

.version 2001
.title
SPLASH
TOC

All but the SPLASH keyword are required at the beginning of your HBK file. Note that SPLASH and TOC must be capitalized.

In the second column of these lines, follow .title with the title of the book and follow SPLASH and TOC with the names of Mathcad files. See Figure 2, below.

Figure 2: Sample HBK file.

Note that in the HBK file lines that begin with a semicolon ( ; ) are ignored and can be used to provide comments. Also, you should use tabs to separate text entries into columns.

  3. Enter a line with three columns for each file in the book. Again, use tabs to separate columns. In the first column, type the logical name of the file (the filename without the extension). In the second column, type the filename. In the third column, type a colon ( : ), a space, and the title of the file that should appear in the title bar of the book window. See Figure 2, above.

  4. Save the HBK file as a text-only file with an HBK extension and a name that is the same as the name of the folder containing the Mathcad worksheets included in the book. For example, if a folder called ALGEBRA contains all the worksheets and subfolders for the Electronic Book "Explorations in Algebra," save the HBK file as ALGEBRA.HBK.

  5. Look for a subfolder called HANDBOOK located within your Mathcad folder. If you do not have a subfolder called HANDBOOK, create one.

  6. Place the HBK file and the folder containing your worksheets in the HANDBOOK folder. For example, place ALBEGRA.HBK and the ALGEBRA folder in the HANDBOOK folder.

At this point, Mathcad has all the information it needs to create a functional Electronic Book. All that remains is to check the HBK file for errors. You also may create an index for your electronic book to help users find specific topics. This process is discussed in creating index entries.

Notes:

  • The file names in the first and second columns should not contain any spaces.

  • You can create an HBK file using any text editor or word processing application. Just be sure to save the HBK file as text-only.

  • Further information on HBK organization can be found in using subfolders to organize your files and tips for creating an HBK file.


Using Subfolders to Organize

Using Subfolders to Organize Your Files

If you have many files in an Electronic Book, you can place those files in subfolders under the main folder. For example, if you have several worksheets under each of the topics "Continued Fractions" and "Prime Numbers," you might place them in two subfolders called FRACTIONS and PRIMES, respectively, under the ALGEBRA folder.

If you decide to use subfolders to organize your worksheets, you need to make additional entries at the top of your HBK file just below the version and title entries. For example, if you have two subfolders called FRACTIONS and PRIMES, the beginning of your HBK would look something like this:

.version 2001
.title
.path algebra
.path algebra\fractions
.path algebra\primes
SPLASH
TOC

For every subfolder there must be a path entry in the HBK file.

Notes:

  • You do not need to make an entry for the subfolder that contains your popup worksheets since these files do not appear in the HBK file.

  • If all your worksheets are contained in a single folder you do not need to make any path entries in your HBK file.


Tips for Creating an HBK File

Here are some tips for creating an HBK file:

  • Limit the worksheet filenames to eight characters to avoid problems some networks may have reading long filenames.

  • If the titles of your files are very long, abbreviate them so they are not cut off when they appear at the top of the Electronic Book window. Think of your titles as running heads or headers that appear at the top of a book page.

  • Files to which hyperlinks popup rather than jump and files linked to from outside your Electronic Book (such as those on the World Wide Web) do not have to be listed in the HBK file.

  • If you include a space and the keyword "skip" following the name of a file in the second column of the HBK file, a reader of the book will not be able to browse to that file. This is helpful if you want people to link to a file, like a solution, but not browse to it through the Table of Contents. Here is a sample:

Also remember that:

  • In your HBK file, any line beginning with a semicolon is ignored.

  • You may not include any blank lines in the HBK file.


Checking Your HBK File

Once you have created an HBK file, you can check it for errors using the Handbook Utilities. In order to access Handbook Utilities, you must close Mathcad and restart it in HBK mode. HBK mode is a run-time execution of Mathcad that can be started using the Run... command from the Start menu in Windows.

To run HBK mode:

  1. From the Start menu on your Windows toolbar, select Run...

  2. Browse for the Mathcad executable, mathcad.exe, and select it.

  3. At the end of the path to this executable, type a space and then “/hbkmode.” The entire path might look like this in the Run dialog box:

"C:\Program Files\Mathcad 2001 Professional\mathcad.exe" /hbkmode

Be sure to type /hbkmode outside the quotes that ordinarily enclose the path of an executable.

  4. Click “OK” in the Run dialog box.

Mathcad will start up and the Handbook Utilities dialog box will appear. You will see a checkbox option called “Check Handbook.” This utility checks the correctness of your HBK file, the structure and content of the worksheets that comprise your Electronic Book, and the links between files. If HBK mode encounters any errors, a report is generated listing the errors. The error log file, called ErrorLog.txt, appears in the HANDBOOK folder and includes details about the following errors:

  • Files in the main folder or subfolders of your Electronic Book that are not listed in the HBK file.

  • Files listed in the HBK file that are not in the main folder or subfolders of your Electronic Book.

  • Invalid hyperlinks.

  • Computational errors in any of your Mathcad worksheets.

Select the “Check Handbook” option to check your book for errors and correct them. If you make any changes to the worksheets in your Electronic Book, you may also want to recheck links using this utility.

When you are satisfied with your work, you can open your Electronic Book.


Creating Index Entries in Regions

You can create a searchable phrase index for your Electronic Book much as the author of a printed book creates an index. To see an example of a searchable index, choose Resource Center from the Help menu and click on the [image] button.

You can create all your index entries, region-by-region, by running Mathcad in Authoring mode. This mode allows you to generate an index automatically when you have finished writing your Electronic Book. Authoring mode is a run-time execution of Mathcad that can be started using the Run... command from the Start menu in Windows. When you run Authoring mode, you enable an index attribute for all regions in a Mathcad worksheet.

To run Authoring mode:

  1. From the Start menu, select Run...

  2. Browse for the Mathcad executable, mathcad.exe, and select it.

  3. At the end of the path to this executable, type a space and then “/a.” The entire path might look like this in the Run dialog box:

"C:\Program Files\Mathcad 2001 Professional\mathcad.exe" /a

Be sure to type /a outside the quotes that ordinarily enclose the path of an executable.

  4. Click “OK” in the Run dialog box.

Mathcad will start up and you are now running the program in Authoring mode. At this point, you can create your worksheets as normal. However, for every region that you want to be referenced in a searchable index, you may now create an index entry.

To create an index entry or entries for a region:

  1. Right-click the region and select Properties from the pop-up menu.

  2. Under the Index tab, type any index entry that you would like to have for that region. Index entries may contain any characters except the vertical bar symbol, |. A vertical bar is used to separate entries if you would like more than one entry for a given region. For example, a multiple index entry line might look like this:

fractions, dividing|dividing fractions

These entries will appear alphabetically in the final index. Think carefully about your index entries, following these indexing tips.

  3. Click “OK” to close the Properties dialog box.

After indexing the desired regions of your worksheets, you can automatically generate the index for your Electronic Book.

Tips:

  • It is a good idea to list terms in multiple ways. For example, the topic “Prime Numbers” might be indexed under “numbers, prime” and “prime numbers.”
  • If you are using unusual terms for a concept, also include standard terms that readers might be looking for.
  • The more entries you add to the index, the more helpful it will be for your users.


Automatically Generating an Index

Running HBK mode

Once you have created all the index entries in your worksheets, you can generate the index automatically using the Handbook Utilities feature. Checking your HBK file provides instructions on how to run HBK mode.

Generating the index

Mathcad will start up and the Handbook Utilities dialog box will appear. You will see a checkbox option called “Generate Index.” Executing the “Generate Index” command creates a file called INDEX.TXT in the same location as your HBK file. If you make any changes to the worksheets in you Electronic Book, you must regenerate the index.

Sorting the index

In order to complete the index process, you must sort the INDEX.TXT file. Follow these steps:

To sort the index:

  1. Open INDEX.TXT in Microsoft Word or another word processing application.

  2. We recommend that you use Word because you can convert the entire contents of the file to a table. To do so in Word, choose Select All from the Edit menu, then choose Convert Þ Text to Table from the Table menu. In the Convert Text to Table dialog box, specify 3 columns and separate text with a vertical bar, |. Click “OK.”

  3. Sort the table by the first column (index entry), then the third column (file name), then the second column (region number). To do so in Word, choose Sort from the Table menu, and use the dialog box.

  4. Once you have sorted the table, convert the table back to text. To do so in Word, choose Select Table from the Table menu, then choose Convert Þ Table to Text. In the Convert Table to Text dialog box, specify a vertical bar, |, as the separator.

  5. Save your newly sorted index in Text Only format. To do so, choose Save As from the File menu and select Text Only (*.txt) from the file format list.

Processing the index

The final step is to process the index. To process the index:

  1. Place the following files in one folder:

  • NEWDICT.EXE (index utility located in the main Mathcad folder)

  • INDEX.TXT file

  • the HBK file (for our example, this is ALGEBRA.HBK)

  2. In MSDOS or Command Prompt mode, change to that folder and type:

newdict index.txt algebra.hbk

If there is an error in the index file, NEWDICT.EXE stops its execution and issues a line number on which the error occurs. If an error occurs, check and fix errors. Run NEWDICT.EXE until it executes completely without issuing an error.

  3. The successful execution of NEWDICT.EXE will create two files, OUT.DCT and OUT.RFS. Rename these files to correspond to the name of the HBK file and folder for your Electronic Book. For example, if you have a folder called ALGEBRA and an HBK file called ALGEBRA.HBK, rename the files to ALGEBRA.DCT and ALGEBRA.RFS.

  4. Place the DCT and RFS files inside your Electronic Book folder. For example, put them in the ALGEBRA folder.

When you are satisfied with the results, you can open your Electronic Book.

Notes:

  • If you make any changes to the contents of the worksheets that comprise your Electronic Book or if you make any changes to the HBK file, you must rerun the index and recheck your handbook.

  • Errors will occur if there are any blank lines in either the index or the HBK file. Many errors also occur because of discrepancies between file names in the index file and the HBK file or because file names are missing.

  • Fixing index errors may involve going back to your worksheets and modifying specific index entries. In this case, you must regenerate the index. Keep this in mind when you are creating index entries initially or if you decide to change your index in any way.


Opening Your Electronic Book

To open your Electronic Book:

  1. Start Mathcad and choose Open Book from the Help menu.

  2. Browse to the location of your HBK file and click on it.

  3. Click “Open.”

Your book opens in the Electronic Book window. Use the buttons on the toolbar at the top of the window to browse the book. For example, click [image] to go to the Table of Contents or click [image] to open the searchable index. Readers of your Electronic Book can annotate it through the book menu.


Overview of MathML Web Sites

Overview

As described in the Introduction to Mathcad-Generated Web Sites, a collection of Mathcad documents can be exported to HTML/MathML format for Web browsing. You can create the entire site using Mathcad and template files. The steps to creating a site include:

  1. Creating Mathcad files for HTML/MathML Export

  2. Adding (relative) hyperlinks between appropriate files.

  3. Preparing a table of contents file, hyperlinked to all the other files in your document set (see our template samples in the download area of Mathcad.com for ways to do this automatically with Javascript).

  4. Preparing a template file with overall navigation, header, and other document information.

  5. Setting your HTML Output Preferences and template file.

  6. Choosing Save As... or Save as Web Page... from the File menu to save each file with the HTML/MathML format, and then finishing your Web site.

Each step is explained in more detail in the following sections.


Introduction to Mathcad-Generated Web Sites

Mathcad is known for the ease with which math equations, text, and graphics can be combined in a single document. For authors and publishers, these documents can form the basis of a typeset, formatted, mathematics-based Web site for online distribution. Mathcad documents can be exported as HTML, with a variety of options for displaying equations and graphs. Documents are then viewable by anyone with a standard web browser (Netscape 4.7 or greater, or IE 5.0 or greater). In addition, all documents exported by Mathcad can be read back into Mathcad for further calculation.

Special Features of Mathcad Generated Web Sites

Mathcad makes it easy to publish mathematics online, formerly an arduous task involving the creation of many images and complicated markup by hand. When you use Mathcad to generate HTML pages, the following features apply:

  • Every equation retains information about its content, not just how it looks on screen; this means you can read the documents back into Mathcad as if they were native .mcd files, with all calculations intact (round-trip, content-based MathML).
  • Because HTML/MathML documents behave like Mathcad documents within Mathcad, it's easy to edit them: just open the .htm version and edit in Mathcad, then Save As... or Save As Web Page... in HTML/MathML format again.
  • Embedded images and hyperlinks will be preserved as you go from Mathcad to the Web. Links to .mcd files in Mathcad will be converted to links to .htm files in HTML/MathML.
  • Anyone can browse your documents.
  • MathML documents are true HTML documents, and can include any additional markup, Javascript, or other Web features you wish to create in the exported document. We recommend you use HTML templates for additional content, so this content will be preserved as you bring documents in and out of Mathcad.

The following sections discuss the steps to create your own MathML Web Sites.

Images vs. Presentation MathML

Two formats are available for storing equation regions: you can choose images, which are viewable by everyone but require additional files, or presentation MathML in one of several versions, which will require a MathML renderer or a browser which is capable of rendering MathML. In either case, content MathML is stored in the file, so it can be read back into Mathcad.

What is MathML

MathML is the math markup language developed to the XML standards of the W3C. MathML markup can exist in the same document with standard HTML for text and graphics. Mathcad will do all the HTML and MathML markup for you, based on the equations, text, and graphics in your existing Mathcad document. You can even apply an export template, if you choose, that creates the navigation, headers and other stylistic elements for a Web site.

If you wish to use presentation MathML for equation display, you and your readers will require a MathML renderer. Some browsers can also render MathML natively, for which you'll have to use the inline MathML option. Check www.mathcad.com for information on rendering options.


Creating Mathcad Files for MathML Export

Creating Mathcad Files for HTML/MathML Export

First, create the Mathcad worksheets that, when exported, will comprise your Web site. Place all the worksheets into a folder designated for your Web Site. When you are naming files, you may wish to use some organized naming scheme, such as topic0.mcd, topic1.mcd, topic2.mcd, etc..., and retain these names when you export to the .htm versions of the file. Some of the sample templates included with Mathcad use Javascript to keep track of files in the site, but require them to have sequential naming structures such as this.

To create a consistent look for your worksheets, you can create and use templates and text styles. Refer to Mathcad Help on templates and text styles for more information. Note that Mathcad templates are used for setting styles within Mathcad, and are different from HTML templates that are used to create HTML navigation and wrappers for HTML/MathML content. The use of Mathcad templates to set styles in your document is recommended, as these styles will be translated to an inline Cascading Style Sheet in the output HTML document.

When you are using an HTML template, you will have to use relative layout in your documents, as selected in Preferences on the "HTML Options" tab. Mathcad regions are exported into an HTML table that tries to maintain horizontal and vertical positioning between regions through rows and columns. The more consistent you are about aligning regions to several well-defined vertical guides, the quicker and cleaner this export will be. We suggest you use Guidelines every 1.5 inches or so. See the section on aligning regions and using the Ruler guidelines.

Once you have created your worksheets, you can hyperlink documents for your Web site.

Tip:

  • If you want to include data from a data file in a worksheet, you should insert an input table and import the data into it. This will ensure your book is readable even if it is on a CD or on a Web site. Refer to Mathcad Help on Importing Data from a Data File for information on importing data to an input table.

  • If you are using Referenced Files in your worksheets, be sure to save the Referenced File as HTML/MathML as well, so it goes along with your project. References will be turned into hyperlinks on export.


Adding Hyperlinks Between Files for MathML Export

You can insert hyperlinks to Mathcad files from each of the topics in a Mathcad table of contents, or from specific areas in individual files, to allow users to quickly browse the contents of your documents. Mathcad hyperlinks are exported as .htm anchor links in standard HTML markup. Be sure to export all linked and referenced documents, or these links won't have a file to point to.

Note that in order for hyperlinks to export meaningfully to HTML, you must choose the "Use Relative Path" box in the Insert Hyperlink dialog. It is also best to specifically select a few important words or phrases for the link, rather than linking from a whole region. When links are displayed in HTML, you'll find whatever text you chose rendering with color changes and underlining, so choose your link text carefully.

After creating the Mathcad worksheets, aligning them properly, linking them together, and creating a table of contents, if necessary, you need to create an HTML Template file to specify any HTML wrapping for your exported documents.


Creating an HTML Template File

Template files are HTML files with certain comment lines and <HEAD> information that tell Mathcad how to read it in and where to insert the MathML content exported from a Mathcad worksheet. Template files are saved with an .mlt extension. Template files can include any valid HTML markup, such as

  • <IMG> tags, and image maps for navigating through your content,

  • <LINK>s to cascading style sheets,

  • <A> hyperlinks to .htm files,

  • Javascript to automatically generate links, create date stamps, or for any other functionality,

  • any valid HTML markup.

Templates should be tested using a Web browser; Mathcad will not attempt to render or understand any of the template HTML markup, with the exception of the few lines detailed below. You can either test your templates by opening up the .mlt file in a Web Browser, or you can save a Mathcad document as HTML using the template, and open the resulting .htm file.

A Web Template file is saved with a .mlt extension, and must include the following four sets of comment tags, in addition to whatever HTML markup you wish to appear in the final document. Between the the document <HEAD> tags:

<!-- #BeginEditable "Title" -->
<title>sample title goes here</title>
<!-- #EndEditable -->

<!-- #BeginEditable "MathMLheaders" -->
META tag information written here
<!-- #EndEditable -->

<!-- #BeginEditable "MathMLstyles" -->
Cascading styles written here
<!-- #EndEditable -->

Be sure to fill in a title between the title tags. This title is only overwritten when you specify a new title in the Save as Web Page dialog box. If you do not specify a new title, the template title tags will be used.

Wherever you want the Mathcad worksheet to go in the template, place the following lines in the document <BODY> tags:

<!-- #BeginEditable "MathMLcontent" -->
HTML/MathML Content from Mathcad worksheet will be overwritten here
<!-- #EndEditable -->

Note that these templates are different from Mathcad Worksheet style templates.

These comments allow Mathcad to create the <META> tags necessary to read exported .htm files back into Mathcad, write out any styles, etc.

You can create an HTML template file using any text editor or HTML Markup application. Just be sure to save the file with an .mlt extension. You may wish to start with the sample HTMLtemplate.mlt file in the templates directory in your Mathcad install directory, and make changes to suit your own site. If you do use the template files provided, be sure to enter your own affiliation and contact information, and change the title in the <TITLE> tags.

The image file madewithmathcad.jpg is used in the HTML of the sample template file that ships with Mathcad; please copy this file into the directory of a any exported files made using this template.

To use the .mlt file you just created, you'll need to set your HTML Output Preferences.

Notes:

  • You can create an HTML template file using any text editor or HTML-processing application. Just be sure to save with the .mlt extension, and save the contents as text-only.
  • Be sure to move any images, style sheets, Javascript source files, or other files referenced by links in your template to the same directory in which you are saving your exported Mathcad files. Using a template and saving a mathcad file is equivalent to moving the template file (with new content) to the new Save As... directory.


Setting your HTML Output Preferences

When preparing to export Mathcad documents as HTML/MathML, you'll want to set a preferences for formatting and images, and select your output template, if desired. The Preferences dialog box is displayed by choosing Preferences... from the Tools menu. Click the "HTML Output" tab to set HTML and MathML export choices.

Equation Export

Choose to display your equations as images or MathML. If you choose images, equation regions will be saved according to the image choices set for the document (see below). If you choose MathML, select whether it will be wrapped in <OBJECT> tags for display with IBM techexplorer, or if it will be placed inline with the HTML as additional markup. The second option requires a specialized browser that reads MathML tags. The first requires an Active-X component to be downloaded and installed on the browser.

Image Export

You can set the format for image export to JPEG or PNG. PNG is a “lossless” format that often results in clearer images for graphs and drawings, while JPEG images are often smaller and usually compatible with older browser versions. Note that all Mathcad objects that are not equations (graphs and data tables in particular) cannot be expressed as MathML or HTML. These objects are exported as images.

Layout Style

You can choose whether a document will use relative or absolute positioning when exported to MathML/HTML. If the Save layout as option is set to “Relative” your Mathcad regions will be output into an HTML table which attempts to retain relative horizontal and vertical placement between regions. This makes it possible to edit the MathML document outside of Mathcad to include additional HTML-navigation links, images, etc., as all positions of text and math on the page will reflow depending on what comes before them. Relative layout must be selected to use HTML templates.

If you check the fixed layout radio button, each MathML/HTML expression will be precisely positioned on a web page, mimicing the original Mathcad document as precisely as possible, but making it difficult to add new items to the page outside of Mathcad. Choice of template will be ignored in this case.

When you are satisfied with your choices, you can save your files as HTML/MathML. You can also set these preferences at save time by choosing Save as Web Page from the File menu.

Note:

Changes to your template file will only affect future Mathcad documents saved out as HTML/MathML, it won't retroactively change files already saved.


Finishing your Web Site

Checking your Web Site

To check your finished Web Site:

  1. Save all Mathcad documents to be included in the site as HTML/MathML files, making sure that the file names are what you expect them to be given any interdocument hyperlinks or scripting in your templates.

  2. Open the first page (probably called index.htm or default.htm) containing your table of contents, and click around to the other pages on your site using your hyperlinking structure. You should find all links correctly translated to .htm files, and all content from your templates inserted around the MathML from your Mathcad documents.

  3. Correct any filenames, template problems, or alignment problems for Mathcad regions that aren't exporting as expected.

That's it, you're done. You can put your .htm files, and their associated image directories, on any internal or external web server. In our sample templates, we've included buttons that link to the Mathcad site, so if your readers MathML plug-ins or want information on how to get Mathcad so they can calculate with your web documents, they can find it online.


What Is a Popup?

A popup is a small window that appears in the Mathcad viewing area when you click a hyperlink that is specified as a popup window. Popups are usually very short pages displaying extra information about a topic without taking up space in the main document.

Popup files are useful for specifying definitions, presenting solutions, or providing short tutorials without taking the reader away from your document. Popup files are full Mathcad files that can be edited directly.

Tips:

  • To create a popup file, make a short Mathcad file generally about one screen or less to avoid forcing the reader to scroll through it.

  • Store popup files in a subdirectory called Popups, for easy organization.